home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 029a / tsbat27.zip / DELPATH.BAT < prev    next >
DOS Batch File  |  1990-10-21  |  2KB  |  64 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Delete a directory from the path variable         │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 21-Oct-90 │
  6. echo └───────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. if "%1"=="" goto _help
  10. if "%2"=="" goto _label_1
  11. echo The extra parameters are ignored
  12.  
  13. rem Change the directory-name parameter to upper case
  14. :_label_1
  15. set _stash=%path%
  16. path %1
  17. set _dir=%path%
  18. path %_stash%
  19. set _stash=
  20.  
  21. rem Check that the auxiliary file setvar.bat is available
  22. set _found=
  23. if exist setvar.bat set _found=yes
  24. for %%d in (%path%) do if exist %%d\setvar.bat set _found=yes
  25. if "%_found%"=="yes" goto _label_2
  26. echo Auxiliary file setvar.bat must be at path or in the current directory
  27. goto _out
  28.  
  29. rem Check if there is such a directory (not really necessary)
  30. :_label_2
  31. set _found=
  32. for %%d in (%path%) do if "%%d"=="%_dir%" set _found=yes
  33. if "%_found%"=="yes" goto _label_3
  34. echo Directory %_dir% not at path
  35. goto _out
  36.  
  37. rem Build the path anew
  38. :_label_3
  39. set _newpath=
  40. for %%d in (%path%) do if not "%%d"=="%_dir%" call setvar %%d
  41. path %_newpath%
  42. goto _out
  43.  
  44. :_help
  45. echo Usage: DELPATH [Directory]
  46. echo.
  47. echo MsDos version 3.30 required.
  48. echo SETVAR.BAT mush be at path.
  49. echo.
  50. echo If you get an "Out of environment space" message, increase your
  51. echo environment space by using shell configuration in config.sys:
  52. echo Example: shell=c:\bin\command.com /e:1024 /p
  53. echo.
  54. echo Current path %path%
  55. goto _out2
  56.  
  57. :_out
  58. set _newpath=
  59. set _dir=
  60. set _found=
  61. path
  62. :_out2
  63. echo on
  64.